﻿#include <iostream>

using namespace std;

//股票1
class Stock1 {
public:
    void Sell() {
        cout << "股票1卖出" << endl;
    }
    void Buy() {
        cout << "股票1买入" << endl;
    }
};

class Stock2 {
public:
    void Sell() {
        cout << "股票2卖出" << endl;
    }
    void Buy() {
        cout << "股票2买入" << endl;
    }
};

class Stock3 {
public:
    void Sell() {
        cout << "股票3卖出" << endl;
    }
    void Buy() {
        cout << "股票3买入" << endl;
    }
};

class NationalDebt1 {
public:
    void Sell() {
        cout << "国债1卖出" << endl;
    }
    void Buy() {
        cout << "国债1买入" << endl;
    }
};

class Realty1 {
public:
    void Sell() {
        cout << "房地产1卖出" << endl;
    }
    void Buy() {
        cout << "房地产1买入" << endl;
    }
};

class Fund {
private:
    shared_ptr<Stock1> gu1;
    shared_ptr<Stock2> gu2;
    shared_ptr<Stock3> gu3;
    shared_ptr<NationalDebt1> nd1;
    shared_ptr<Realty1> rt1;
public:
    Fund() {
        gu1 = shared_ptr<Stock1>(new Stock1());
        gu2 = shared_ptr<Stock2>(new Stock2());
        gu3 = shared_ptr<Stock3>(new Stock3());
        nd1 = shared_ptr<NationalDebt1>(new NationalDebt1());
        rt1 = shared_ptr<Realty1>(new Realty1());
    }
    void BuyFund() {
        gu1->Buy();
        gu2->Buy();
        gu3->Buy();
        nd1->Buy();
        rt1->Buy();
    }
    void SellFund() {
        gu1->Sell();
        gu2->Sell();
        gu3->Sell();
        nd1->Sell();
        rt1->Sell();
    }
};

int main(int argc, char *argv[])
{
    shared_ptr<Fund> jijin(new Fund());
    //基金购买
    jijin->BuyFund();
    //基金赎回
    jijin->SellFund();

    return 0;
}
